#include "Board.h"

U64 Board::getPieceSet( enumPiece pt ) const
{
	 return pieceBB[pt];
}

U64 Board::getWhitePawns() const
{
	return pieceBB[nWhitePawn];
}

U64 Board::getBlackPawns() const
{
	return pieceBB[nBlackPawn];
}

U64 Board::getWhiteRook() const
{
	return pieceBB[nWhiteRook];
}

U64 Board::getBlackRook() const
{
	return pieceBB[nBlackRook];
}

U64 Board::getWhiteKnight() const
{
	return pieceBB[nWhiteKnight];
}

U64 Board::getBlackKnight() const
{
	return pieceBB[nBlackKnight];
}

U64 Board::getWhiteBishop() const
{
	return pieceBB[nWhiteBishop];
}

U64 Board::getBlackBishop() const
{
	return pieceBB[nBlackBishop];
}

U64 Board::getWhiteQueen() const
{
	return pieceBB[nWhiteQueen];
}

U64 Board::getBlackQueen() const
{
	return pieceBB[nBlackQueen];
}

U64 Board::getWhiteKing() const
{
	return pieceBB[nWhiteKing];
}

U64 Board::getBlackKing() const
{
	return pieceBB[nBlackKing];
}

U64 Board::getWhites() const
{
	return pieceBB[nWhite];
}

U64 Board::getBlacks() const
{
	return pieceBB[nBlack];
}

U64 Board::getOccupied() const
{
	return occupiedBB;
}

U64 Board::getEmpty() const
{
	return emptyBB;
}

unsigned int Board::firstOne(U64 bitmap)
{

	static const int INDEX64[64] = {
		63,  0, 58,  1, 59, 47, 53,  2,
		60, 39, 48, 27, 54, 33, 42,  3,
		61, 51, 37, 40, 49, 18, 28, 20,
		55, 30, 34, 11, 43, 14, 22,  4,
		62, 57, 46, 52, 38, 26, 32, 41,
		50, 36, 17, 19, 29, 10, 13, 21,
		56, 45, 25, 31, 35, 16,  9, 12,
		44, 24, 15,  8, 23,  7,  6,  5  };

		static const U64 DEBRUIJN64 = U64(0x07EDD5E59A4E28C2);

#pragma warning (disable: 4146)
		return INDEX64[((bitmap & -bitmap) * DEBRUIJN64) >> 58];  
}
